package com.rizzo.analytics.domain.notification;

import com.google.common.collect.Sets;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;

import java.io.Serializable;
import java.util.Collection;


public class NotifiedService implements Serializable {

    private static final long serialVersionUID = 24L;

    private String service;

    private Collection<Notification> notifications;

    public NotifiedService() {
    }

    public NotifiedService(String service, Collection<Notification> notifications) {
        this.service = service;
        this.notifications = notifications;
    }

    public String getService() {
        return service;
    }

    public void setService(String service) {
        this.service = service;
    }

    public Collection<Notification> getNotifications() {
        if (notifications == null) {
            this.notifications = Sets.newHashSet();
        }
        return notifications;
    }

    public void setNotifications(Collection<Notification> notifications) {
        this.notifications = notifications;
    }

    @Override
    public boolean equals(Object o) {
        return EqualsBuilder.reflectionEquals(this, o);
    }

    @Override
    public int hashCode() {
        return HashCodeBuilder.reflectionHashCode(this);
    }

    @Override
    public String toString() {
        return "NotifiedService{" +
                "service='" + service + '\'' +
                ", notifications=" + notifications +
                '}';
    }
}
